//
//  BKMatchingScholarshipDataSource.m
//  baokaodaxue
//
//  Created by SKar on 15/6/1.
//  Copyright (c) 2015年 宏图教育. All rights reserved.
//

#import "BKMatchingScholarshipDataSource.h"
#import "BKMatchingScholarshipTableViewCell.h"

@implementation BKMatchingScholarshipDataSource

- (instancetype)initWithArray:(NSArray *)array
               cellIdentifier:(NSString *)cellIdentifier
                configureCell:(ConfigureCell)configureCell {
    self = [super init];
    if (self) {
        _dataArray = array;
        _cellIdentifier = cellIdentifier;
        _configureCell = configureCell;
    }
    return self;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.dataArray count]+1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    BKMatchingScholarshipTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:self.cellIdentifier forIndexPath:indexPath];
    cell.selectionStyle  = UITableViewCellSelectionStyleNone;
    
    if (indexPath.row==0) {
        cell.collegeNameLabel.text = @"高校";
        cell.scholarshipLabel.text = @"奖金";
        cell.conditionLabel.text = @"获奖条件";
        return cell;

    }
    NSDictionary *dic = self.dataArray[indexPath.row-1];
    cell.collegeNameLabel.text = dic[@"name"];
    cell.scholarshipLabel.text = dic[@"edu"];
    cell.conditionLabel.text = dic[@"biaozhun"];
    
    if (indexPath.row%2==0) {
        cell.backgroundColor = [UIColor colorWithRed:0.910 green:0.965 blue:0.980 alpha:.8];
    }else{
    
    
        cell.backgroundColor = [UIColor clearColor];
    }
    return cell;
}

@end
